// @ts-ignore
/* eslint-disable */
import request from "@/request"

/** deletePicture POST /api/picture/delete */
export async function deletePictureUsingPost(body: API.DeleteRequest, options?: { [key: string]: any }) {
	return request<API.BaseResponseBoolean_>("/api/picture/delete", {
		method: "POST",
		headers: {
			"Content-Type": "application/json"
		},
		data: body,
		...(options || {})
	})
}

/** editPicture POST /api/picture/edit */
export async function editPictureUsingPost(body: API.PictureEditRequest, options?: { [key: string]: any }) {
	return request<API.BaseResponseBoolean_>("/api/picture/edit", {
		method: "POST",
		headers: {
			"Content-Type": "application/json"
		},
		data: body,
		...(options || {})
	})
}

/** getPictureById GET /api/picture/get */
export async function getPictureByIdUsingGet(
	// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
	params: API.getPictureByIdUsingGETParams,
	options?: { [key: string]: any }
) {
	return request<API.BaseResponsePicture_>("/api/picture/get", {
		method: "GET",
		params: {
			...params
		},
		...(options || {})
	})
}

/** getPictureVOById GET /api/picture/get/vo */
export async function getPictureVoByIdUsingGet(
	// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
	params: API.getPictureVOByIdUsingGETParams,
	options?: { [key: string]: any }
) {
	return request<API.BaseResponsePictureVO_>("/api/picture/get/vo", {
		method: "GET",
		params: {
			...params
		},
		...(options || {})
	})
}

/** listPictureByPage POST /api/picture/list/page */
export async function listPictureByPageUsingPost(body: API.PictureQueryRequest, options?: { [key: string]: any }) {
	return request<API.BaseResponsePagePicture_>("/api/picture/list/page", {
		method: "POST",
		headers: {
			"Content-Type": "application/json"
		},
		data: body,
		...(options || {})
	})
}

/** listPictureVOByPage POST /api/picture/list/page/vo */
export async function listPictureVoByPageUsingPost(body: API.PictureQueryRequest, options?: { [key: string]: any }) {
	return request<API.BaseResponsePagePictureVO_>("/api/picture/list/page/vo", {
		method: "POST",
		headers: {
			"Content-Type": "application/json"
		},
		data: body,
		...(options || {})
	})
}

/** listPictureVOByPageWithCache POST /api/picture/list/page/vo/cache */
export async function listPictureVoByPageWithCacheUsingPost(
	body: API.PictureQueryRequest,
	options?: { [key: string]: any }
) {
	return request<API.BaseResponsePagePictureVO_>("/api/picture/list/page/vo/cache", {
		method: "POST",
		headers: {
			"Content-Type": "application/json"
		},
		data: body,
		...(options || {})
	})
}

/** doPictureReview POST /api/picture/review */
export async function doPictureReviewUsingPost(body: API.PictureReviewRequest, options?: { [key: string]: any }) {
	return request<API.BaseResponseBoolean_>("/api/picture/review", {
		method: "POST",
		headers: {
			"Content-Type": "application/json"
		},
		data: body,
		...(options || {})
	})
}

/** searchPictureByColor POST /api/picture/search/color */
export async function searchPictureByColorUsingPost(
	body: API.SearchPictureByColorRequest,
	options?: { [key: string]: any }
) {
	return request<API.BaseResponseListPictureVO_>("/api/picture/search/color", {
		method: "POST",
		headers: {
			"Content-Type": "application/json"
		},
		data: body,
		...(options || {})
	})
}

/** listPictureTagCategory GET /api/picture/tag_category */
export async function listPictureTagCategoryUsingGet(options?: { [key: string]: any }) {
	return request<API.BaseResponsePictureTagCategory_>("/api/picture/tag_category", {
		method: "GET",
		...(options || {})
	})
}

/** updatePicture POST /api/picture/update */
export async function updatePictureUsingPost(body: API.PictureUpdateRequest, options?: { [key: string]: any }) {
	return request<API.BaseResponseBoolean_>("/api/picture/update", {
		method: "POST",
		headers: {
			"Content-Type": "application/json"
		},
		data: body,
		...(options || {})
	})
}

/** uploadPicture POST /api/picture/upload */
export async function uploadPictureUsingPost(
	// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
	params: API.uploadPictureUsingPOSTParams,
	body: {},
	file?: File,
	options?: { [key: string]: any }
) {
	const formData = new FormData()

	if (file) {
		formData.append("file", file)
	}

	Object.keys(body).forEach(ele => {
		const item = (body as any)[ele]

		if (item !== undefined && item !== null) {
			if (typeof item === "object" && !(item instanceof File)) {
				if (item instanceof Array) {
					item.forEach(f => formData.append(ele, f || ""))
				} else {
					formData.append(ele, JSON.stringify(item))
				}
			} else {
				formData.append(ele, item)
			}
		}
	})

	return request<API.BaseResponsePictureVO_>("/api/picture/upload", {
		method: "POST",
		params: {
			...params
		},
		data: formData,
		requestType: "form",
		...(options || {})
	})
}

/** uploadPictureByBatch POST /api/picture/upload/batch */
export async function uploadPictureByBatchUsingPost(
	body: API.PictureUploadByBatchRequest,
	options?: { [key: string]: any }
) {
	return request<API.BaseResponseInt_>("/api/picture/upload/batch", {
		method: "POST",
		headers: {
			"Content-Type": "application/json"
		},
		data: body,
		...(options || {})
	})
}

/** uploadPictureByUrl POST /api/picture/upload/url */
export async function uploadPictureByUrlUsingPost(body: API.PictureUploadRequest, options?: { [key: string]: any }) {
	return request<API.BaseResponsePictureVO_>("/api/picture/upload/url", {
		method: "POST",
		headers: {
			"Content-Type": "application/json"
		},
		data: body,
		...(options || {})
	})
}
